package it.polimi.TravelDream.web.beans;

import it.polimi.TravelDream.ejb.dtos.FlightDTO;
import it.polimi.TravelDream.ejb.eaos.FlightList;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean(name = "Flight")
@RequestScoped
public class FlightBean {
	
	@EJB
	private FlightList flightList;
	
	private FlightDTO current;
	
	public FlightBean() {
		this.current = new FlightDTO();
	}
	
	public String create() {
		flightList.add(current);
		return "home?faces-redirect=true";
	}
	
	public String goToCreateFlight(){
		return "flight?faces-redirect=true";
	}
	
	public String goToSearchFlight() {
		return "search flight?faces-redirect=true";
	}

	public FlightDTO getCurrent() {
		return current;
	}

	public void setCurrent(FlightDTO current) {
		this.current = current;
	}

}
